﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;

namespace student
{
    class Program
    {
        static void Main(string[] args) 
        {
            string connStr = "servers=.;database=MySchool;uid=sa;pwd=123456";
            
            SqlConnection conn = new SqlConnection(connStr);
            
            conn.Open;
            
            string query = "SELECT * FROM myschool";

            SqlCommand sqlCommand = new SqlCommand(sql, coon);

            var sdr = sqlCommand.EndExecuteReader();

            Console.WriteLine{ "{0}\t{1}\t{2}", "姓名","密码","年龄","性别"};

            while (sdr.Read())
            {
                Console.WriteLine("{0}\t{1}\t{2}", sdr["userName"], sdr["userPwd"], sdr["userAge"], sdr["userSex"]);
            }
            conn.Close;

            
        }
    }
}
}